#include <cstdio>

int n;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("pas.in", "r", stdin);
  freopen("pas.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    if (i * i % n == 1) printf("%d\n", i);
  }
  return 0;
}